<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<div class="mainbar">
	<div class="page-head">
		<h2 class="pull-left">
			<i class="icon-table"></i>
			<spring:message code="menu.listCategory.label" />
		</h2>
		<div class="clearfix"></div>
	</div>
	<div class="matter">
		<div class="container-fluid">

			<!-- Table -->

			<div class="row-fluid">

				<div class="span9 offset1">

					<div class="widget">

						<div class="widget-head">
							<div class="pull-left">
								<spring:message code="menu.listCategory.label" />
							</div>
							<div class="pull-right">
								<a href="${pageContext.request.contextPath}/admin/getAddCategory"
									class="btn btn-mini btn-success"> <i class="icon-pencil"></i>
									<spring:message code="menu.addCategory.label" /></a>

							</div>
							<div class="clearfix"></div>
						</div>

						<div class="widget-content">

							<table id="adminTable"
								class="table table-striped table-bordered table-hover">

								<thead>
									<tr>
										<th style="width: 20px">#</th>
										<th style="min-width: 100px; max-width: 250px"><spring:message
												code="menu.categoryname.label" /></th>
										<th style="min-width: 100px; max-width: 250px"><spring:message
												code="menu.categorydesc.label" /></th>
										<th style="min-width: 50px; max-width: 250px"><spring:message
												code="table.header.processdate" /></th>
										<th style="min-width: 50px; max-width: 250px"><spring:message
												code="table.header.user" /></th>
										<th><spring:message code="menu.isActive.label" /></th>
										<th style="width:100px"><spring:message
												code="menu.control.label" /></th>

									</tr>
								</thead>

								<tbody>
									<c:forEach items="${categoryList}" var="cate" varStatus="count">
										<tr>
											<td>${count.count}</td>
											<td><c:out value="${cate.name}" /></td>
											<td><c:out value="${cate.description}" /></td>
											<td><c:out value="${cate.processDate}" /></td>
											<td><c:out value="${cate.user}" /></td>
											<td>
											<c:choose>
												<c:when test="${cate.id < 10}">	
											<c:choose>
													<c:when test="${cate.isActive == true}">
															<a id="showbutton${cate.id}" style="width: 3px;"  class="not-active-link"
															onclick="return confirmDeactive('Category', ${cate.id});">Hiển
															Thị</a>
													</c:when>
													<c:otherwise>
															<a id="showbutton${cate.id}" style="width: 3px;"  class="not-active-link"
															onclick="return confirmDeactive('Category', ${cate.id});">Không
															Hiển Thị</a>
													</c:otherwise>
												</c:choose>
												</c:when>
												<c:otherwise>
												<c:choose>
												<c:when test="${cate.isActive == true}">
															<a id="showbutton${cate.id}" style="width: 3px;"
															onclick="return confirmDeactive('Category', ${cate.id});">Hiển
															Thị</a>
													</c:when>
													<c:otherwise>
															<a id="showbutton${cate.id}" style="width: 3px;"
															onclick="return confirmDeactive('Category', ${cate.id});">Không
															Hiển Thị</a>
													</c:otherwise>
													</c:choose>
												</c:otherwise>
												</c:choose>
												</td>
											<td>
												<form action="getUpdateCategory" method="get" style="width:50px; float:left">
													<button type="submit" class="btn btn-mini btn-warning">
														<i class="icon-pencil"></i>
														<spring:message code="menu.edit.label" />
													</button>
													<input type="hidden" value="${cate.id}" name="cateId">
												</form>
												<c:choose>
												<c:when test="${cate.id < 10}">	
													<button onclick="confirmDelete('Category', ${cate.id})" class="btn btn-mini  btn-danger" disabled="disabled">
														<i class="icon-pencil"></i>
														<spring:message code="menu.delete.label" />
													</button>
												</c:when>
												<c:otherwise>
												<button onclick="confirmDelete('Category', ${cate.id})" class="btn btn-mini  btn-danger">
														<i class="icon-pencil"></i>
														<spring:message code="menu.delete.label" />
													</button>
													</c:otherwise>
												</c:choose>
											</td>
										</tr>
									</c:forEach>
								</tbody>

							</table>

						</div>
						<div class="widget-foot"></div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>